#!/usr/bin/env python 
# -*- coding:utf-8 -*-
"""
@Time:2021/12/11 3:43 下午"
@Author:lydia_liu"
@File:contact_page.py
@function:
"""
from time import sleep

from selenium.webdriver.common.by import By

from po_master.page_object.base_page import BasePage
from po_master.page_object.member_page import MemberPage

class ContactPage(BasePage):

    _NAME_LOC = (By.CSS_SELECTOR,'.member_colRight_memberTable_td:nth-child(2)')
    _ADD_BTN = (By.LINK_TEXT, '添加成员')
    def click_addmember_button(self):
        print("在通讯录页面，点击添加成员按钮")

        sleep(5)
        # self.driver.find_element(By.LINK_TEXT, '添加成员').click()
        self.onclick(*self._ADD_BTN)

        return MemberPage(self.driver)

    def get_membernames(self):

        print("获取成员列表名字")

        elements = self.finds(*self._NAME_LOC)

        name_list = [ele.get_attribute('title') for ele in elements]

        return name_list